# # 从生成的.py文件导入定义的窗口类
# from ui_mainwindow import Ui_MainWindow
# from PySide2.QtWidgets import QMainWindow
#
# # 定义主窗体
# class MainWindow(QMainWindow):
#     def __init__(self):
#         super(MainWindow, self).__init__()
#         self.ui = Ui_MainWindow()
#         self.ui.setupUi(self)


from PySide2.QtWidgets import QApplication, QMessageBox
from PySide2.QtUiTools import QUiLoader

class Stats:

    def __init__(self):
        # 从文件中加载UI定义

        # 从 UI 定义中动态 创建一个相应的窗口对象
        # 注意：里面的控件对象也成为窗口对象的属性了
        # 比如 self.ui.button , self.ui.textEdit
        self.ui = QUiLoader().load('ui/learn1.ui')


    def handleCalc(self):
        print('hello')

if __name__ == "__main__":
    app = QApplication([])
    #实例化窗口
    mainwindow = Stats()
    mainwindow.ui.show()
    app.exec_()

